﻿<!--#include file="include/conn_f.asp"-->
<!--#include file="include/function.asp"-->
<!--#include file="include/syscode.asp"-->
<%


    Dim gameCoinId, gameCoinPriceId, gameCoinDistrictId, gameCoinServerId, gameCoinDivDisplay, gameCoinDivId, gameCoinQuantityValue, singlePrice, totalPrice, singlePriceTip, totalPriceTip, hiddenSinglePrice, tmp, sql, stockTip, gameCoinDiscount, gameCoinDiscountTip, currStock
    
    gameCoinId = SafeRequest("gameCoinId", 1)
    gameCoinDistrictId = SafeRequest("gameCoinDistrictId", 1)
    gameCoinServerId = SafeRequest("gameCoinServerId", 1)
    gameCoinDivDisplay = SafeRequest("gameCoinDivDisplay", 1)
    gameCoinDivId = SafeRequest("gameCoinDivId", 1)
    gameCoinQuantityValue = SafeRequest("gameCoinQuantity", 1)
    
    '游戏币折扣信息
    Set tmp = Server.CreateObject("ADODB.RecordSet")
    tmp.open "select gameCoinDiscount from gameCoinQuantity where gameCoinId=" & CStr(gameCoinId) & " and gameCoinQuantityValue=" & CStr(gameCoinQuantityValue), conn, 0, 1
    If Not tmp.eof Then
        gameCoinDiscount = tmp("gameCoinDiscount")
    End If
    Call close_rs(tmp)
    '
    Response.Charset = "utf-8"
    '
    If gameCoinId <> "" And IsNumeric(gameCoinId) And gameCoinDistrictId <> "" And IsNumeric(gameCoinDistrictId) And gameCoinServerId <> "" And IsNumeric(gameCoinServerId) Then '有效数字
        '
        If gameCoinDivDisplay <> "1" Then '不显示部落/联盟
            sql = "select gameCoinPriceId,salePrice,currStock from gameCoinPrice where gameCoinId=" & CInt(gameCoinId) & " and gameCoinServerId=" & CInt(gameCoinServerId)
        ElseIf gameCoinDivDisplay = "1" Then
            If gameCoinDivId <> "" And IsNumeric(gameCoinDivId) Then
                sql = "select gameCoinPriceId,salePrice,currStock from gameCoinPrice where gameCoinId=" & CInt(gameCoinId) & " and gameCoinServerId=" & CInt(gameCoinServerId) & " and gameCoinDivId=" & CInt(gameCoinDivId)
            End If
        End If
        '
        Set tmp = Server.CreateObject("ADODB.RecordSet")
        tmp.open sql, conn, 0, 1
        If Not tmp.eof And Not tmp.bof Then
            gameCoinPriceId = tmp("gameCoinPriceId")
            singlePrice = tmp("salePrice")
            singlePriceTip = ""
            If CStr(gameCoinDiscount) <> "" And CStr(gameCoinDiscount) <> "0" Then  '有折扣
                totalPrice = FormatNumber(singlePrice * gameCoinQuantityValue * (1 - gameCoinDiscount), 2)
                gameCoinDiscountTip = "折扣&nbsp;" & FormatNumber(gameCoinDiscount * 100, 2) & "%"
            Else
                totalPrice = FormatNumber(singlePrice * gameCoinQuantityValue, 2)
                gameCoinDiscountTip = "一次购买10000金以上优惠5%"
            End If
            totalPriceTip = ""
            hiddenSinglePrice = singlePrice
            hiddenTotalPrice = totalPrice
            '库存状态
            currStock = tmp("currStock")
        Else
            singlePrice = "0.00"
            singlePriceTip = "暂无价格信息"
            totalPrice = "0.00"
            totalPriceTip = "暂无价格信息"
            hiddenSinglePrice = ""
            hiddenTotalPrice = ""
        End If
        Call close_rs(tmp)
        '库存状态

        'If currStock<=0 Then 
        '	stockTip="缺货,需要预定"
        'ElseIf currStock>0 And currStock<=3000 Then 
        '	stockTip="少量库存"
        'ElseIf currStock>3000 And currStock<=10000 Then 
        '	stockTip="库存正常"
        'ElseIf currStock>10000 Then 
        '	stockTip="库存充足"
        'End If 

    End If
    'Response.Write singlePrice&"|"&singlePriceTip&"|"&totalPrice&"|"&totalPriceTip&"|"&hiddenSinglePrice&"|"&stockTip&"|"&gameCoinDiscountTip&"|"&hiddenTotalPrice&"|"&gameCoinPriceId
    Response.Write(singlePrice & "|" & singlePriceTip & "|" & totalPrice & "|" & totalPriceTip & "|" & hiddenSinglePrice & "|" & gameCoinDiscountTip & "|" & hiddenTotalPrice & "|" & gameCoinPriceId)
%>
